package net.comm.shequ.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.blog.bean.BaseBlog;
import net.comm.param.bean.BaseProperty;
import net.comm.shequ.bean.BaseShequ;
import net.comm.shequ.bean.BaseYewei;
import net.comm.util.StringUtil;

import org.apache.log4j.Logger;
import org.sakaiproject.db.api.SqlReader;

public class DbYeweiService implements SqlReader
{

	static Logger logger = Logger.getLogger(DbYeweiService.class.getName());

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{		
			
			int yeweiID 	= result.getInt(1);	//	序号
			int villageID 	= result.getInt(2);	//	所属社区ID
			String info 	= StringUtil.getValue(result.getString(3));	//	简介
			String address 	= StringUtil.getValue(result.getString(4));	//	地址
			int contactsID 	= result.getInt(5);	//	日常联系人ID
			String tel 		= StringUtil.getValue(result.getString(6));		//	联系方式
			String ctime = StringUtil.getValue(result.getString(7));	//	成立日期
			int pepoleNum = result.getInt(8);	//	委员人数
			String status = StringUtil.getValue(result.getString(9));	//	状态
			String mtime = StringUtil.getValue(result.getString(10));	//	最后修改时间

			// create the Resource from these fields
			return new BaseYewei(  yeweiID,  villageID,  info,  address, contactsID,  tel,  ctime,  pepoleNum,
					 status,  mtime );
		}
		catch (SQLException e)
		{
			logger.error("读取表数据持久层失败！");
			return null;
		}
		
	}
}
